package com.bjgov.scoresys.entity;
// default package

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.OrderBy;

/**
 * ScoreTree entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "score_tree", catalog = "scoresys")
public class ScoreTree implements java.io.Serializable {

	// Fields

	private Integer id;
	private String cateName;
	private Integer pid;
	private String deepPath;
	private Boolean isControl;
	private Boolean hasScoreItem;
	private Short status;
	private Integer percent;
	private Set<ScoreItem> scoreItems = new HashSet<ScoreItem>(0);

	// Constructors

	/** default constructor */
	public ScoreTree() {
	}

	/** minimal constructor */
	public ScoreTree(String cateName) {
		this.cateName = cateName;
	}

	/** full constructor */
	public ScoreTree(Integer id,String cateName, Integer pid, String deepPath,
			Boolean isControl, Boolean hasScoreItem, Short status,
			Integer percent, Set<ScoreItem> scoreItems) {
		this.id = id;
		this.cateName = cateName;
		this.pid = pid;
		this.deepPath = deepPath;
		this.isControl = isControl;
		this.hasScoreItem = hasScoreItem;
		this.status = status;
		this.percent = percent;
		this.scoreItems = scoreItems;
	}

	// Property accessors
	//@GeneratedValue(strategy = IDENTITY)
	@Id
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "CATE_NAME", nullable = false, length = 100)
	public String getCateName() {
		return this.cateName;
	}

	public void setCateName(String cateName) {
		this.cateName = cateName;
	}

	@Column(name = "PID")
	public Integer getPid() {
		return this.pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	@Column(name = "DEEP_PATH", length = 400)
	public String getDeepPath() {
		return this.deepPath;
	}

	public void setDeepPath(String deepPath) {
		this.deepPath = deepPath;
	}

	@Column(name = "IS_CONTROL")
	public Boolean getIsControl() {
		return this.isControl;
	}

	public void setIsControl(Boolean isControl) {
		this.isControl = isControl;
	}

	@Column(name = "HAS_SCORE_ITEM")
	public Boolean getHasScoreItem() {
		return this.hasScoreItem;
	}

	public void setHasScoreItem(Boolean hasScoreItem) {
		this.hasScoreItem = hasScoreItem;
	}

	@Column(name = "STATUS")
	public Short getStatus() {
		return this.status;
	}

	public void setStatus(Short status) {
		this.status = status;
	}

	@Column(name = "PERCENT")
	public Integer getPercent() {
		return this.percent;
	}

	public void setPercent(Integer percent) {
		this.percent = percent;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "scoreTree")
	@OrderBy(clause="id asc")
	public Set<ScoreItem> getScoreItems() {
		return this.scoreItems;
	}

	public void setScoreItems(Set<ScoreItem> scoreItems) {
		this.scoreItems = scoreItems;
	}

}